<template>
  <div class="custom-box">
    <van-swipe @change="onChange" :loop="false">
      <van-swipe-item class="custom-item">
          <img :src="qian.goodsImg">
      </van-swipe-item>
      <van-swipe-item class="custom-item">
          <img src="../assets/a2.jpg">
      </van-swipe-item>
      
      <template #indicator>
          <div class="custom-indicator">{{ current + 1 }}/2</div>
      </template>
    </van-swipe>
    <span class="custom-span" @click="taio">x</span>
    <div class="custom-dve">
      <span class="iconfont icon-zhuanfa"></span>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
    name:'Banner',
    data() {
      return {
        current: 0,
        qian:{}
      };
  },
  methods: {
    onChange(index) {
      this.current = index;
    },
    taio(){
      this.$router.back()
    }
  },
  mounted(){
    axios({
            url:"/api//goods/findGoodsByGid",
            params:{
                id:this.$route.params.xiaoid
            }
        })
        .then(res=>{
            this.qian = res.data.data
        })
  }

}
</script>

<style scoped>
  .custom-box{
    position: relative;
  }
  .custom-box .custom-span{
    position: absolute;
    top: 0.1rem;
    left: 0.1rem;
    display: block;
    width: 0.3rem;
    height: 0.3rem;
    border-radius: 100%;
    background-color: #00000080;
    color: #fff;
    text-align: center;
    line-height: 0.3rem;
  }
  .custom-box .custom-dve{
    position: absolute;
    top: 0.1rem;
    right: 0.1rem;
    width: 0.3rem;
    height: 0.3rem;
    border-radius: 100%;
    background-color: #00000080;
    color: #fff;
    text-align: center;
    line-height: 0.3rem;
  }
  .custom-dve .icon-zhuanfa{
    font-size: 0.12rem;
  }
 .custom-indicator {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 2px 5px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 0.12rem;
    color: #fff;
  }
  .custom-item{
      width: 3.6rem;
      height: 2.38rem;
  }
  .custom-item img{
      width: 100%;
      height: 100%;
  }
</style>